﻿Imports System.Xml.Linq
Imports System.Text
Namespace Entities
    Public Class PhraseList
        Public Property Label As String
        Public Property Items As ICollection(Of String) = New List(Of String)

        Public Function GetXml() As String
            If Not Validate() Then Return Nothing
            Dim strBuild = New StringBuilder
            strBuild.AppendFormat("<PhraseList Label=""{0}"">", Label)
            strBuild.AppendLine()
            For Each l In Items
                strBuild.AppendFormat("<Item>{0}</Item>", l)
                strBuild.AppendLine()
            Next
            strBuild.AppendFormat("</PhraseList>")
            Return strBuild.ToString()
        End Function

        Public Function Validate() As Boolean
            If String.IsNullOrWhiteSpace(Label) Then Return False

            Return True
        End Function
    End Class
End Namespace